// package com.ithanwen.filter;
//
// import com.ithanwen.utils.JwtUtils;
//
// import javax.servlet.*;
// import javax.servlet.annotation.WebFilter;
// import javax.servlet.http.HttpServletRequest;
// import javax.servlet.http.HttpServletResponse;
// import java.io.IOException;
//
// /**
//  * Created By tony
//  * <br/>Date: 2025/8/13 14:34
//  * <br/>Description:
//  */
// @WebFilter
// public class JwtFilter implements javax.servlet.Filter{
//     @Override
//     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//         HttpServletRequest request = (HttpServletRequest) servletRequest;
//         HttpServletResponse response = (HttpServletResponse) servletResponse;
//         String RequestUri = request.getRequestURI();
//         if(RequestUri.contains("/login")){
//             //放行
//             filterChain.doFilter(servletRequest,servletResponse);
//             return;
//         }
//
//         String token = request.getHeader("token");
//         if(token == null || !JwtUtils.validateToken(token)){
//             response.setStatus(401);
//         }else{
//             filterChain.doFilter(servletRequest,servletResponse);
//         }
//     }
//
// }
